Is it possible to build & apply a filter based on Absolute Number values stored in an array absNos[]?
int absNos[]={1,2,3,5} //normally this is populated via user input
absNosCount=sizeof(absNos)
Filter f=null
int i
for (i=0; i<absNosCount; i++)
{
int absNo=absNos[i]
if (f==null)
{ //seems to not work if not quoted, but can't quote int variable!
f=(attribute "Absolute Number" == absNo)
}
else
{ //this syntax may not be legal:
f=f || (attribute "Absolute Number" == absNo)
}
}
strathglass - Wed Mar 11 09:08:01 EDT 2009 |
Re: Filter Absolute Numbers in array? -Strathglass |
Re: Filter Absolute Numbers in array? |
Re: Filter Absolute Numbers in array? SystemAdmin - Wed Mar 11 09:20:15 EDT 2009 Regards, Strathglass |
Re: Filter Absolute Numbers in array? Module mCurr = current Object obj filtering off for obj in entire mCurr do { reject(obj) // by default ...if (isDeleted(obj)) continue // don't show deleted object ...if (row(obj) or table(obj)) continue // cannot show Table or Row headers ...if (cell(obj)) continue // don't show table cells ...if (this object qualifies) then accept(obj) } filtering on Notice there is no 'Filter' variables, nor no 'set(Filter)' commands using this method. >Louie |
Re: Filter Absolute Numbers in array? filtering on int absNos[]={1,2,3,5} //normally this is populated via user input absNosCount=sizeof(absNos) Filter f=null int i for (i=0; i<absNosCount; i++) { int absNo=absNos[i] if (f==null) { //seems to not work if not quoted, but can't quote int variable! f=(attribute "Absolute Number" == absNo "") } else { //this syntax may not be legal: f=f || (attribute "Absolute Number" == absNo "") } } int iAccepted,iRejected set(current,f,iAccepted,iRejected) print "Filter =" stringOf(current,f) "\n" print "Accepted: " iAccepted " -- Rejected: " iRejected "\n" |
Re: Filter Absolute Numbers in array? Doug.Zawacki - Wed Mar 11 14:37:11 EDT 2009 I realize I forgot the set() call in my example. But I didn't realize I simply had to cast my integer to string to successfully build my filter string. Thanks again! And thanks Louie too - that is how I ended up coding it per Pekka's input too, before I saw Doug's response. Regard, Strathglass. |
Re: Filter Absolute Numbers in array? Doug.Zawacki - Wed Mar 11 14:37:11 EDT 2009 If you just use accept and reject, you can filter as desired. But this does not affect the filter functions current filter list: so if you try to save your filtering done with accept and reject in a view it will not work: the filtering is NOT saved (at least,not the filtering you did using accept/reject). However with Doug's approach, the filter is a normal filter added to the filter function as the current filter: this CAN be saved in a view! Regards, strathglass |
Re: Filter Absolute Numbers in array? strathglass - Thu Mar 26 09:55:43 EDT 2009
Hey guys. I'm trying to do this kind of filter. Getting a problem. Here's the code.
Object o;
Filter f = null;
Filter temp;
Buffer objID = create();
int absNum;
for o in problemObjects do {
objID = (string key(problemObjects));
objID = objID[(contains(objID, '-')+1):];
absNum = intOf(tempStringOf(objID));
if(null(f)) {
f = attribute "Absolute Number" == absNum "";
}
else {
f = f || attribute "Absolute Number" == absNum "";
}
}
print stringOf(current, f) "\n";
int accepted, rejected
set(currentMod, f, accepted, rejected);
filtering(on);
refresh(currentMod);
print accepted "\n"
print rejected "\n"
delete(objID);
objID = null;
|
Re: Filter Absolute Numbers in array? dpechacek - Wed Sep 23 17:18:10 EDT 2009
Hey guys. I'm trying to do this kind of filter. Getting a problem. Here's the code.
Object o;
Filter f = null;
Filter temp;
Buffer objID = create();
int absNum;
for o in problemObjects do {
objID = (string key(problemObjects));
objID = objID[(contains(objID, '-')+1):];
absNum = intOf(tempStringOf(objID));
if(null(f)) {
f = attribute "Absolute Number" == absNum "";
}
else {
f = f || attribute "Absolute Number" == absNum "";
}
}
print stringOf(current, f) "\n";
int accepted, rejected
set(currentMod, f, accepted, rejected);
filtering(on);
refresh(currentMod);
print accepted "\n"
print rejected "\n"
delete(objID);
objID = null;
Its working for me when I manually set your Skip problemObjects. My guess is that your 'currentMod' is no longer your current module, for whatever reason. If so, you are turning 'filtering(on)' on some other module, probably the one you opened to find your 'problemObjects'. Check it out: add print "Current Module before filter = [" name(current Module) "]\n"
|
Re: Filter Absolute Numbers in array? llandale - Wed Sep 23 19:16:49 EDT 2009 Its working for me when I manually set your Skip problemObjects. My guess is that your 'currentMod' is no longer your current module, for whatever reason. If so, you are turning 'filtering(on)' on some other module, probably the one you opened to find your 'problemObjects'. Check it out: add print "Current Module before filter = [" name(current Module) "]\n"
AAI Services, Textron dpechacek@aai.textron.com David.Pechacek@gmail.com |